/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package game.server;

import java.io.Serializable;
import java.net.Socket;

/**
 * Class ...
 *
 * @author Y.D.Zakovryashin
 * @version 1.x Creation date: Nov 27, 2013, time: 4:25:48 PM User login: yz *
 */
public class Gamer implements Serializable {

    private String login;
    private Socket socket;
    private int idGame;
    private int id; // Only ZERO or PLUS
    
    public Gamer (String log, Socket s) {
        login = log;
        socket = s;
    }
    
    public String getLogin () {
        return login;
    }
    
    public Socket getSocket () {
        return socket;
    }
    
    public int getGameID () {
        return idGame;
    }
    
    public int getId () {
        return id;
    }
    
    public boolean setGameId (int i) {
        if ( i < 0 ) {
            return false;
        }
        idGame = i;
        return true;
    }
    
    public boolean setId ( int i) {
        if (i == IGameServer.PLUS
                || i == IGameServer.ZERO ) {
            id = i;
            return true;
        }
        return false;
    }
    
    public String toString () {
        return login + ": " + socket
                + ", gameId: " + idGame
                + ", id: " + id;
    }
}
